/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package runebound.ui.combate;

import java.awt.CardLayout;
import runebound.modelo.heores.Heroe;
import runebound.modelo.monstruos.Monstruo;
import runebound.modelo.monstruos.comportamientos.AntesDeCombateTest;
import runebound.random.Tirada;

/**
 *
 * @author Miguel (alakat@gmail.com)
 */
public class RBCombatePanel extends javax.swing.JPanel {

    
    private Monstruo monstruo;
    private Heroe heroe;
    
    /**
     * Creates new form RBCombatePanel
     */
    public RBCombatePanel() {
        initComponents();
        this.showAntes();
    }

    public void setCombate(Monstruo m, Heroe h){
        this.monstruo=m;
        this.heroe=h;
        this.rBDuranteCombatePanel1.setCombate(m, h);
        this.rBTestAntesCombatePanel1.setMonstruo(m);
        this.rBTestAntesCombatePanel1.setHeroe(h);
        if((m.getAntesDeCombate()!=null)&&
                (m.getAntesDeCombate() instanceof AntesDeCombateTest)  ){
            this.rBTestAntesCombatePanel1.setTest((AntesDeCombateTest) m.getAntesDeCombate());
        }else{
            rBTestAntesCombatePanel1.setNoTest();
        }
            
    }
    
    /**
     *  Muestra el Antes de un combate
     */
    public final void showAntes(){
        ((CardLayout)this.getLayout()).show(this, "TestAntes");
    }
    
    public void showDuranteCombate(){
        ((CardLayout)this.getLayout()).show(this, "Durante");
    }
    
    public void showFinCombate(){
        
        ((CardLayout)this.getLayout()).show(this, "Fin");
        this.rBFinCombatePanel1.setMonstruo(this.monstruo);
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rBTestAntesCombatePanel1 = new runebound.ui.combate.RBAntesCombateTestPanel();
        rBDuranteCombatePanel1 = new runebound.ui.combate.RBDuranteCombatePanel();
        rBFinCombatePanel1 = new runebound.ui.combate.RBFinCombatePanel();

        setLayout(new java.awt.CardLayout());
        add(rBTestAntesCombatePanel1, "TestAntes");
        add(rBDuranteCombatePanel1, "Durante");
        add(rBFinCombatePanel1, "Fin");
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private runebound.ui.combate.RBDuranteCombatePanel rBDuranteCombatePanel1;
    private runebound.ui.combate.RBFinCombatePanel rBFinCombatePanel1;
    private runebound.ui.combate.RBAntesCombateTestPanel rBTestAntesCombatePanel1;
    // End of variables declaration//GEN-END:variables

    public RBDuranteCombatePanel getrBDuranteCombatePanel() {
        return rBDuranteCombatePanel1;
    }

    public void nuevaRondaCombate(){
        this.rBDuranteCombatePanel1.nuevaRondaCombate();
    }
    
}
